<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="">
    <link rel="stylesheet" type="text/css" href="">
    <script type="text/javascript" src="../resources/fw/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="../resources/fw/fwCommon.js"></script>
    <script type="text/javascript">

        // 调用SERVICE
        $.fwDoService({
            fw_service: "commService",
            fw_method: "login",
            fw_param: {}, //只需要修改
            success: function (rstJson) {
                alert(1);
                console.log(rstJson);
            }
        });
        //页面初始化
        $(function () {
            //   cookies.clearCookie();            //清空COOKIE
            //判断是否存在COOKIE
            if (document.cookie != "") {
                console.log(cookies.getJSONS());
                var formData = cookies.getJSONS();
                //表单赋值：
                $(formData).each(function () {
                    console.log(this);
                    $("input[name='" + this.name + "'][value='" + this.value + "']").attr("checked", this.checked);
                });
            }

            //绑定事件
            $("#myform input").bind("change", function () {
                //保存到COOKIE中
                var formData = {};
                formData.name = this.name;
                formData.value = this.value;
                formData.checked = this.checked;
                console.log(formData);
                if (this.checked) {
                    cookies.setJSON(this.name, formData);
                } else {
                    cookies.delJSON(this.name);
                }
            })
        });
    </script>
</head>
<body>
<h2>上传多个文件 实例</h2>

<form id="myform">
    <label>性别：</label><input name="sex" type="radio" value="nan"/>男
    <input name="sex" type="radio" value="nv"/>女 <BR/>
    <label>科目：</label>
    <input name='subject1' type="checkbox" value="Chinese"/><label>语文</label>
    <input name='subject2' type="checkbox" value="Math"/><label>数学</label>
    <input name='subject3' type="checkbox" value="English"/><label>英语</label>
    <input name='subject4' type="checkbox" value="Sport"/><label>体育</label>
</form>
</body>
</html>